package com.zhongxi.guoyuan.adapter.beautifulStore;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.zhongxi.guoyuan.R;

import java.util.List;

/**
 * Created by Administrator on 2016/11/8.
 */

public class DetailStepAdapter extends BaseAdapter {

    private LayoutInflater mLayoutInflater;
    private List<String> data;

    public DetailStepAdapter(Context context, List<String> data) {
        this.mLayoutInflater = LayoutInflater.from(context);
        this.data = data;
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int position) {
        return data.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if(convertView==null){
            holder = new ViewHolder();
            convertView = mLayoutInflater.inflate(R.layout.item_step, parent, false);
            holder.tvStep = (TextView) convertView.findViewById(R.id.tvStep);
            holder.ivImg = (ImageView) convertView.findViewById(R.id.ivImg);
            convertView.setTag(holder);
        }else{
            holder = (ViewHolder) convertView.getTag();
        }
        return convertView;
    }
    private class ViewHolder{
        private TextView tvStep;
        private ImageView ivImg;
    }
}
